
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            outline:0;
        }
        .clearfix {
            content:'';
            /* 清浮动元素必须是块级元素 */
            display: block;
            clear:both;
            /* 使内容不占位 */
            width: 0;
            height: 0;
            visibility: hidden;
        }
        .green {
            background-color: green;
        }
        .orange {
            background-color: orange;
        }
        .w150 {
            width: 150px;
            height:150px;
        }
        main{
            height:100px;
        }
        .left{
            float: left;
        }
        .right {
            float:right;
        }
        .grial {
            /* 圣杯式三栏布局 padding 把左右的侧边栏的位置让出来*/
            padding: 0 150px;

        }
        .grial main {
            float:left;
            width:100%;
        }
        .grial .left {
            /* 100% 相对于父元素的100% */
            margin-left:-100%;
            position: relative;
            left:-150px;
        }
        .grial .right {
            float:left;
            margin-left:-150px ;
            position: relative;
            right:-150px;
        }
    </style>
</head>
<body>
    <div class="layout">
        <h4>方法一：圣杯布局</h4>
        <section class="grial clearfx">
            <!-- main 自适应 -->
            <!-- 中间部分在 DOM 结构上优先 -->
            <main class="green">main</main>
            <aside class="w150 left orange">aside</aside>
            <aside class="w150 right orange">aside</aside>
        </section>
    </div>
</body>
</html>